const CompressionPlugin = require('compression-webpack-plugin')

module.exports = {
publicPath: './',
  devServer: {
    port: 80,
    https: false,
    open: false,
        // 添加代理配置
        proxy: {
          '/api': {
            target: 'https://poetize.cn', // 目标服务器地址（替换成实际地址）
            changeOrigin: true,                // 是否更改请求头中的 origin
            pathRewrite: {
              '^/api': ''                      // 重写路径，例如 /api/xxx -> /xxx
            }
          }
        }
  },
  lintOnSave: false,
  productionSourceMap: false,
  configureWebpack: {
    plugins: [
      new CompressionPlugin({
        algorithm: 'gzip',
        test: /\.js$|\.html$|\.css$/,
        filename: '[path].gz[query]',
        minRatio: 1,
        threshold: 10240,
        deleteOriginalAssets: false
      })
    ]
  }
}
